<template>
  <el-card class="app-container">
    <c-u-r-d-table :option="option" ref="table"/>
  </el-card>
</template>

<script>

import ColumnType from '@/framework/constant/ColumnType'
import WithdrawMethodEnum from '@/feature/fms/infra/constants/WithdrawMethodEnum'
import { withdrawApi } from '@/feature/fms/infra/api/withdrawApi'
import CURDTable from '@/framework/components/table/CURDTable'
import WithdrawStatusEnum from '@/feature/fms/infra/constants/WithdrawStatusEnum'

export default {
  components: { CURDTable },
  data() {
    return {
      option: {
        requestApi: withdrawApi,
        showSelection: false,
        columns: [
          // {
          //   label: '用户ID',
          //   prop: 'userId',
          //   searchable: true,
          //   type: ColumnType.SELECT
          // },
          {
            label: '提现方式',
            prop: 'withdrawMethod',
            type: ColumnType.RADIO,
            tagMode: false,
            options: WithdrawMethodEnum
          },
          {
            label: '状态',
            searchable: true,
            type: ColumnType.RADIO,
            hiddenInForm: true,
            options: WithdrawStatusEnum,
            prop: 'status'
          },
          {
            label: '提现金额(元)',
            prop: 'amount'
          }, {
            label: '备注',
            prop: 'remark'
          },
          {
            label: '银行名称',
            prop: 'bankName'
          }, {
            label: '银行卡号',
            searchable: true,
            prop: 'bankCardNo'
          }, {
            label: '持卡人姓名',
            searchable: true,
            prop: 'bankUsername'
          }, {
            label: '持卡人身份证',
            prop: 'bankIdNo'
          }, {
            label: '持卡人手机号',
            searchable: true,
            prop: 'bankTelephone'
          }, {
            label: '开户行所在城市',
            prop: 'bankCity'
          },
          {
            label: '创建时间',
            type: ColumnType.DATETIME,
            hiddenInForm: true,
            prop: 'gmtCreate'
          },
          {
            label: '修改时间',
            type: ColumnType.DATETIME,
            hiddenInForm: true,
            prop: 'gmtModified'
          }
        ]
      }
    }
  },
  methods: {
    handleMoney({ arg }) {
      this.$confirm('确定打款了吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      })
        .then(() => {
          withdrawApi.markWithdrawalSuccess(arg.id).then(() => {
            this.$notify({
              title: '成功',
              message: '操作成功',
              type: 'success',
              duration: 2000
            })
            this.$refs.table.reloadTable()
          })
        })
        .catch(() => {})
    }
  }
}
</script>

